<?php
require_once('mysql_table.php');

class articulos_subnivel1 extends mysql_table{

    function __construct(){
        parent::__construct();
        $this->TableName = "ARTICULOS_SUBNIVEL1";
        $this->IDField = "ID";        
        
        $this->fields['ID']  = "";
        $this->fields['ID_ARTICULO']  = "";
        $this->fields['ID_SUBNIVEL1'] = "";
        
    }
    
    function buscar($id_articulo){
        
        $query = "SELECT ARTICULOS_SUBNIVEL1.*,
					SUBNIVEL1.DESCRIPCION AS DESCRIPCION, 
					SUBNIVEL1.DESCRIPCION_ADMIN AS DESCRIPCION_ADMIN,  
					SUBCATEGORIA.DESCRIPCION AS DESCRIPCION_SUB, 
					SUBCATEGORIA.DESCRIPCION_ADMIN AS DESCRIPCION_ADMIN_SUB, 
					CATEGORIAS.DESCRIPCION AS DESCRIPCION_CAT, 
					CATEGORIAS.DESCRIPCION_ADMIN AS DESCRIPCION_ADM_CAT, 
					PRODUCTOS.DESCRIPCION AS DESCRIPCION_PRO, 
					PRODUCTOS.DESCRIPCION_ADMIN AS DESCRIPCION_ADMIN_PRO 
					FROM 
					CATEGORIAS, ARTICULOS_SUBNIVEL1, 
					PRODUCTOS, SUBCATEGORIA, SUBNIVEL1    
					WHERE 
					SUBNIVEL1.ID = ARTICULOS_SUBNIVEL1.ID_SUBNIVEL1 
					AND SUBNIVEL1.ID_SUBCATEGORIA = SUBCATEGORIA.ID   
					AND SUBNIVEL1.ID_CATEGORIA = CATEGORIAS.ID 
					AND SUBNIVEL1.ID_PRODUCTO = PRODUCTOS.ID 
					AND ARTICULOS_SUBNIVEL1.ID_ARTICULO =".$id_articulo." 
					AND SUBNIVEL1.ID_STATUS != 0
					AND SUBCATEGORIA.ID_STATUS != 0
					AND CATEGORIAS.ID_STATUS != 0 
					AND PRODUCTOS.ID_STATUS != 0 
					ORDER BY SUBNIVEL1.DESCRIPCION ASC";
        $salida = $this->tovector_assoc_query($query);
       //print($query);
        return $salida;
            
    }
    
}
?>
